package com.ict.txmsv2.services;

import com.ict.txmsv2.model.Message;
import com.ict.txmsv2.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import com.ict.txmsv2.mapper.MessageMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author yoleen
 * @date 2021/1/18 10:56
 */

@Service
public class MessageService {
    @Autowired
    MessageMapper messageMapper;


    public int insertMessage(Message message) {
        return messageMapper.insertSelective(message);
    }

    public List<Message> getAllMessageByUserId(Integer id) {
        return messageMapper.getAllMessageByUserId(id);
    }

    public void updateMessage(Message message) {
        messageMapper.updateByPrimaryKeySelective(message);
    }

    public void readMessage(Integer fromId, Integer toId) {
        messageMapper.readMessage(fromId, toId);
    }
}
